<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>获取全部图片</title>
    <style type="text/css">
        #token{
            width: 100%;
            height: 200px;
        }
        #code{
            width: 100%;
            height: 500px;
        }
        #imgs img{
            width: 200px;
        }
        #imgs div{
            width: 200px;
            float: left;
        }
        #imgs p{
            word-break:break-all;
        }
    </style>
</head>
<body>
<textarea id="token" placeholder="请输入token"></textarea>
<textarea id="code" placeholder="请把json代码全部丢到这里"></textarea>
<button onclick="getImg();">获取图片</button>
<div id="imgs">

</div>
<script type="text/javascript">
    function getImg(){
        var token = document.getElementById("token").value;
        var code = document.getElementById("code").value;
        code = code.replace(" ","");
        var reg = /(\"fjserverpath\":\")((\w|=|\?|\.|\/|&|-)+)(\",)|(\"wjlj\":\")((\w|=|\?|\.|\/|&|-)+)(\",)/g;
        var s = code.match(reg);
        var html='';
        for(var i = 0 ;i<s.length;i++){
            var a = s[i];
            if(a.length>10){
                var path = a.replace("\"fjserverpath\":\"","");
                path = path.replace("\"wjlj\":\"","");
                path = path.substring(0,path.length-2);
                html+="<div><img  title='"+path+"' src='https://apishyun.gree.com/api/pub/nts-foundation-attachmentmanager/api/v2/attachment/download?id="+path+"&access_token="+token+"'/><p>"+path+"</p></div>"
            }
        }
        document.getElementById("imgs").innerHTML=html;
    }
</script>
</body>
</html>